package com.authine.cloudpivot.web.api.controller;

import com.authine.cloudpivot.engine.api.facade.BizObjectFacade;
import com.authine.cloudpivot.web.Utils.ImportUtil;
import com.authine.cloudpivot.web.Utils.InterfaceDockingUtil;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import com.authine.cloudpivot.web.api.domain.dto.CustomerDTO;
import com.authine.cloudpivot.web.api.domain.dto.InterfaceDTO;
import com.authine.cloudpivot.web.api.exception.PortalException;
import com.authine.cloudpivot.web.api.service.CustomerService;
import com.authine.cloudpivot.web.api.view.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(description = "外企德科相关接口", tags = "员工绩效评分")
@RestController
@RequestMapping("/api/ygjxpf")
@Slf4j
@Validated
@Component
public class YGJXPFController extends BaseController {

    @Autowired
    private  CustomerService  customerService;


    @ApiOperation(value = "生成客户信息" )
    @PostMapping("/importExcel")
    @ResponseBody
    public ResponseResult<?> importExcel(@RequestParam("file") MultipartFile file, @RequestParam("userId")  String userId){
        JSONObject json = new JSONObject();
        Long statusReal = 200L;
        try {
            List<List<Object>> orgRows = ImportUtil.excelImport(file, 0);






        }catch (PortalException e) {
                statusReal = 500L;
                json.put("message", "生成客户信息失败：" + e.getErrMsg());
        }catch (IOException ioe){
                statusReal = 500L;
                json.put("message", "生成客户信息失败：" + ioe.getMessage());
        }
        return ResponseResult.<JSONObject>builder().errcode(statusReal).data(json).build();

    }







}
